﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sparkle.MVVM;

namespace Sparkle.Wpf.Demo.UI
{
    /// <summary>
    /// Interaction logic for SparklePopup.xaml
    /// </summary>
    public partial class SparklePopup : UserControl, IPopup
    {
        public SparklePopup()
        {
            InitializeComponent();
            Visibility = Visibility.Collapsed ;
        }

        private void ButtonCloseClick(object sender, RoutedEventArgs e)
        {
            Hide();
        }

        private void ButtonOkClick(object sender, RoutedEventArgs e)
        {
            Hide();
        }


        #region Implementation of IPopup

        public void Show()
        {
            this.Visibility = Visibility.Visible;
        }

        public void Hide()
        {
            this.Visibility = Visibility.Collapsed;
        }

        public void SetDialogContent(object content, object data)
        {
            if (content is FrameworkElement)
            {
                DialogContent.Content = content;

                var control = content as FrameworkElement;
                DialogContent.Height = control.Height;
                DialogContent.Width = control.Width;
                MainBorder.Width = control.Width + 25;
                MainBorder.Height = control.Height + 70;
            }

        }



        #endregion
    }
}
